package ui;

import javafx.event.ActionEvent;


import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import util.AppException;

import java.io.IOException;
import java.net.URL;
import java.util.*;

public class AppMain implements Initializable {

   @FXML
   private BorderPane appMainPane;

   @FXML
   private void gotoDeptMgr(ActionEvent event) {
      try {
         AnchorPane centerPane = FXMLLoader.load(getClass().getResource("DeptMgr.fxml"));
         appMainPane.setCenter(centerPane);
      } catch (IOException e) {
         e.printStackTrace();
         throw new AppException(e.getMessage(),e.getCause());
      }
   }

   @FXML
   private void gotoLessMgr(ActionEvent event) {
      try {
         AnchorPane centerPane = FXMLLoader.load(getClass().getResource("LessonMgr.fxml"));
         appMainPane.setCenter(centerPane);
      } catch (IOException e) {
         e.printStackTrace();
         throw new AppException(e.getMessage(),e.getCause());
      }
   }

   @FXML
   private void gotoClsMgr(ActionEvent event) {
      try {
         AnchorPane centerPane = FXMLLoader.load(getClass().getResource("ClassMgr.fxml"));
         appMainPane.setCenter(centerPane);
      } catch (IOException e) {
         e.printStackTrace();
         throw new AppException(e.getMessage(),e.getCause());
      }
   }

   @FXML
   private void gotoStuMgr(ActionEvent event) {
      try {
         AnchorPane centerPane = FXMLLoader.load(getClass().getResource("StuMgr.fxml"));
         appMainPane.setCenter(centerPane);
      } catch (IOException e) {
         e.printStackTrace();
         throw new AppException(e.getMessage(),e.getCause());
      }
   }

   @FXML
   private void gotoStuLessonMgr(ActionEvent event) {
      try {
         AnchorPane centerPane = FXMLLoader.load(getClass().getResource("StuLessonMgr.fxml"));
         appMainPane.setCenter(centerPane);
      } catch (IOException e) {
         e.printStackTrace();
         throw new AppException(e.getMessage(),e.getCause());
      }
   }


   @FXML
   private void gotoLessonSelAna(ActionEvent event) {
      try {
         AnchorPane centerPane = FXMLLoader.load(getClass().getResource("LessonSelAna.fxml"));
         appMainPane.setCenter(centerPane);
      } catch (IOException e) {
         e.printStackTrace();
         throw new AppException(e.getMessage(),e.getCause());
      }
   }
   
   @FXML
   private void gotoLesRoomMgr(ActionEvent event) {
      try {
         AnchorPane centerPane = FXMLLoader.load(getClass().getResource("LesRoomMgr.fxml"));
         appMainPane.setCenter(centerPane);
      } catch (IOException e) {
         e.printStackTrace();
         throw new AppException(e.getMessage(),e.getCause());
      }
   }

   @FXML
   private void gotoRoomMgr(ActionEvent event) {
      try {
         AnchorPane centerPane = FXMLLoader.load(getClass().getResource("RoomMgr.fxml"));
         appMainPane.setCenter(centerPane);
      } catch (IOException e) {
         e.printStackTrace();
         throw new AppException(e.getMessage(),e.getCause());
      }
   }
   
   @FXML
   private void gotoTeaRoomMgr(ActionEvent event) {
      try {
         AnchorPane centerPane = FXMLLoader.load(getClass().getResource("Tea_RoomMgr.fxml"));
         appMainPane.setCenter(centerPane);
      } catch (IOException e) {
         e.printStackTrace();
         throw new AppException(e.getMessage(),e.getCause());
      }
   }
   
   @FXML
   private void gotoTeaMgr1(ActionEvent event) {
      try {
         AnchorPane centerPane = FXMLLoader.load(getClass().getResource("TeaMgr1.fxml"));
         appMainPane.setCenter(centerPane);
      } catch (IOException e) {
         e.printStackTrace();
         throw new AppException(e.getMessage(),e.getCause());
      }
   }
   
   @FXML
   private void gotoNewWin(ActionEvent event) {
	      try {
	         AnchorPane centerPane = FXMLLoader.load(getClass().getResource("NewWin.fxml"));
	         appMainPane.setCenter(centerPane);   
	      } catch (IOException e) {
	         e.printStackTrace();
	         throw new AppException(e.getMessage(),e.getCause());
	      }
	   }
   @Override
   public void initialize(URL url, ResourceBundle rb) {

   }
}
